#!/usr/bin/env python
# coding: utf-8

# In[1]:


import numpy as np


# In[2]:


n_phi_state, n_phi_action = 5,3 # 状态特征数和行为特征数
# 假设为离散行为空间[0,1,2]代表[静止,左移,右移]
M = 64 # 总的样本数
theta = np.random.random((n_phi_state + n_phi_action,1)) # 8*1
actions = np.eye(3,3) # 3*3
# actions[0] 静止
# actions[1] 左移
# actions[2] 右移
states = np.random.random((M,n_phi_state))


# In[16]:


def get_phi(state, action):
    state = state.reshape(1,-1)
    action = action.reshape(1,-1)
    phi_sa= np.concatenate([state, action], axis = 1) # 3*8
    return phi_sa


# In[27]:


def get_scores(state):
    score = np.zeros(n_phi_action)
    for i in range(len(actions)):
        score[i] = get_phi(state, actions[i]).dot(theta)
    score -= np.mean(score)
    return score


# In[28]:


get_scores(states[0])
scores = [3,5,8]


# In[ ]:




